#RequireAdmin
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=..\res\installer.ico
#AutoIt3Wrapper_Outfile=out\aser.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.16.1
 Author:         myName

 Script Function:
	Template AutoIt script.

#ce ----------------------------------------------------------------------------
#include <MsgBoxConstants.au3>
#include <AltasConstants.au3>
#include <InetConstants.au3>
#cs
; If the directory exists the don't continue.
If FileExists($workingdir) Then
	MsgBox($MB_SYSTEMMODAL, "", "An error occurred. The directory already exists.")
	;Return False
EndIf
#ce
; Open the temporary directory.
ShellExecute(@TempDir)

; Create the directory.
DirCreate($workingdir)


Local $aArray[3]

$aArray[0] = "install-wg.exe"
$aArray[1] = "config-network.exe"
$aArray[2] = "install-wub.exe"

Local $sFilePath = ""
For $vElement In $aArray
	MsgBox($MB_TASKMODAL, "", "Download&Exec File: " & $vElement, 3)

	$sFilePath = $vElement
	ConsoleWrite("curl " &$server &"ftp/" & $sFilePath & " -o " & $sFilePath & @CRLF)
	;RunWait    ("curl " &$server &"ftp/" & $sFilePath & " -o " & $sFilePath, $workingdir , @SW_HIDE )
	InetGet($http_server &"ftp/" & $sFilePath , @TempDir & "\" & $sFilePath, $INET_FORCERELOAD + $INET_IGNORESSL, $INET_DOWNLOADWAIT )
	FileMove(@TempDir & "\" &$sFilePath, $workingdir & "\" &$sFilePath, $FC_OVERWRITE + $FC_CREATEPATH)

	Local $iFileExists = FileExists($workingdir &"\"& $sFilePath)
	; Display a message of whether the file exists or not.
	If $iFileExists Then
		;MsgBox($MB_SYSTEMMODAL, "", "The file exists." & @CRLF & "FileExist returned: " & $iFileExists)
	Else
		MsgBox($MB_SYSTEMMODAL, "", "The file ("&$workingdir &"\"& $sFilePath&") doesn't exist." & @CRLF & "FileExist returned: " & $iFileExists)
		Exit
	EndIf
	# Main
	ConsoleWrite($workingdir & "\" & $sFilePath & @CRLF)
	ShellExecuteWait($workingdir & "\" & $sFilePath)
	; Delete the temporary file.
	FileDelete($sFilePath)
Next
MsgBox($MB_SYSTEMMODAL, "", "配置OK", 3)






